<template>
	<view class="container">
		<!-- 蓝色背景区域 -->
		<view class="blue-bg"></view>
		
		<!-- 内容区域 -->
		<view class="content">
			<!-- 优惠活动列表 -->
			<view class="activity-list">
				<!-- 优惠券卡片 -->
				<view class="activity-card" v-for="(item, index) in activities" :key="index" @click="goToDetail(item)">
					<image class="activity-image" :src="item.image" mode="aspectFill"></image>
					<view class="activity-info">
						<text class="activity-title text-ellipsis">{{item.title}}</text>
						<text class="detail-text">详情 ></text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			activities: [
				{
					id: '1',
					image: '/static/index_活动2.png',
					title: '汽车惠民活动走进计划共和国撒打算大',
					industry: '济源某某汽车行业',
					date: '2023/3/10 11:09',
					currentPrice: '99.00',
					originalPrice: '199.00',
					description: '哇喔！蹭羊毛的看过来！易车修汽车维修服务中心出优惠团购了！',
					endDate: '2023-3-10 08:00 至 2023-3-18 23:59',
					phone: '0379-66666666'
				},
				{
					id: '2',
					image: '/static/index_活动2.png',
					title: '汽车惠民活动走进大大撒啊但是啊撒打算大',
					industry: '济源某某汽车行业',
					date: '2023/3/10 11:09',
					currentPrice: '99.00',
					originalPrice: '199.00',
					description: '哇喔！蹭羊毛的看过来！易车修汽车维修服务中心出优惠团购了！',
					endDate: '2023-3-10 08:00 至 2023-3-18 23:59',
					phone: '0379-66666666'
				}
			]
		}
	},
	methods: {
		buyNow(item) {
			uni.showToast({
				title: '抢购功能开发中',
				icon: 'none'
			})
		},
		goToDetail(item) {
			// 将完整的活动数据通过 url 参数传递
			const params = encodeURIComponent(JSON.stringify(item))
			uni.navigateTo({
				url: `/packagesMap/groupBuyDetail/groupBuyDetail?params=${params}`
			})
		}
	}
}
</script>

<style>
.container {
	min-height: 100vh;
	background: #F7F7F7;
}

.blue-bg {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 360rpx;
	background-color: #2979ff;
}

.content {
	position: relative;
	z-index: 1;
	padding: 32rpx;
}

.activity-list {
	display: flex;
	flex-direction: column;
	gap: 32rpx;
}

.activity-card {
	background: #FFFFFF;
	border-radius: 16rpx;
	box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
	padding: 24rpx;
	transition: transform 0.2s ease;
}

.activity-card:active {
	transform: scale(0.98);
}

.activity-image {
	width: 640rpx;
	height: 370rpx;
	border-radius: 12rpx;
	box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.08);
}

.activity-info {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-top: 24rpx;
}

.activity-title {
	font-size: 28rpx;
	color: #333;
	max-width: 70%;
}

.text-ellipsis {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.detail-text {
	font-size: 28rpx;
	color: #999;
}

</style> 